#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int arr[10] = {1, 3, 5, 7, 9, 2, 4, 6, 8, 10};
    int a,b,c;

    c=999;

    while(c)
    {
        cout <<"输入需要被替换掉的下标："<< endl;
        cin >> a;

        if(a <= 9 && a >= 0)
        {
            cout <<"输入使用的新元素："<< endl;
            cin >> b;
            arr[a] = b;
            cout <<"替换成功"<< endl;
            break;
        }
        else
        {
            cout <<"请重新输入需要被替换掉的下标！"<< endl;
            cout << "输入0结束!输入其他继续 "<< endl;
            cin >> c;
        }
    }
    for(int i = 0; i <= 9; i++)
    {
        cout << arr[i] << endl;
    }
    return 0;
}
